

#ifndef __gui_testsH__
#define __gui_testsH__

#include "gui_window.h"

namespace WtfGui
{
	class CreditsDialog : public Window
	{
		DATA_OBJECT(CreditsDialog, sizeof(CreditsDialog));
		
		protected:
			Widgets::Label::tRef	mrLabel;
			
			typedef WtfEngine::Interpolator<fVector4D, WtfEngine::Functions<fVector4D>::Linear>	tCreditsAnimation;
			
			class CreditsAnimation : public Widgets::Label
			{
				class TextChange : public WtfEngine::Animation {
					CreditsDialog::tRef		mrAnim;
					WtfEngine::String 					msText;
					
					public:
						TextChange(const CreditsDialog::tRef& rAnim, const WtfEngine::String& sText) : Animation(), mrAnim(rAnim), msText(sText) {
						};
						
						virtual void Update(WtfEngine::tGameTime dt) {
							mrAnim->mrLabel->setCaption(msText);
							mrAnim->mrLabel->ExpandToText();
							mrAnim->OnResize();
							WtfEngine::Animation::Destroy();
						};
				};
				
				public:
					CreditsAnimation(const CreditsDialog::tRef& r) : Widgets::Label("Woosta Table Football:\nCredits") {
						SetFgColour(new Colour("", fVector4D()), false);
						
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 1.0), 1.0))->After
						(new TextChange(r, "Beta Testing:\nMichael Brown\n(unknown)"))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 0.0), 1.0))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 1.0), 1.0))->After
						(new TextChange(r, "Sound & Music:\n Dan Horgan\n(EvilLord Enterprises)"))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 0.0), 1.0))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 1.0), 1.0))->After
						(new TextChange(r, "Graphics & Artwork:\n Mac Duy, Hai\n(Micron Developers)"))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 0.0), 1.0))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 1.0), 1.0))->After
						(new TextChange(r, "Game Engine:\n Sean Micklethwaite\n(Dynamo Game Studios)"))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 0.0), 1.0))->After
						(new tCreditsAnimation(getFgColour()->Value.Value, fVector4D(1.0, 1.0, 1.0, 1.0), 1.0))->Init();
					};
			};
			
		public:
			CreditsDialog() : Window("Credits") {
				mrLabel = new CreditsAnimation(this);
				AddChild(mrLabel);
				
				mrLabel->ExpandToText();
				
				Resize(400, 300);
			};
			
			virtual void OnResize() {
				setPadding(IWidgetLayout::tPadding((getSize() - mrLabel->getSize()) / 2, (getSize() - mrLabel->getSize()) / 2));
				Window::OnResize();
			};
	};
};

#endif
